package ArrayTest;
/*
对引用型数组的探究
 */
public class ArrayTest4 {
    public static void main(String[] args){
        Student[] students = new Student[2];
        Student s1 = new Student();
        Student s2 = new Student();
        //将新创建的对象存进Student数组
        students[0] = s1;
        students[1] = s2;
        for(int i = 0; i < students.length; i++){
            students[i].study(); //取出学生对象，调用study方法
        }
    }
}
class Student{
    public void study(){
        System.out.println("学生在学习！");
    }
}
